<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <title>后台管理-商品管理</title>
    <!--自己的样式-->
    <link rel="stylesheet" type="text/css" href="css/backstage.css">
    <!-- Bootstrap -->
    <!--fileinput 样式-->
    <link rel="stylesheet" type="text/css" href="css/fileinput.css">
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <!--动画CSS插件-->
    <link rel="stylesheet" type="text/css" href="css/animate.min.css" th:href="@{/css/animate.min.css}">
    <script src="js/jquery-3.2.1.min.js" th:src="@{/js/jquery-3.2.1.min.js}"></script>
    <script src="js/bootstrap.js" th:src="@{/js/bootstrap.js}"></script>
    <script src="js/fileinput.js" th:src="@{/js/fileinput.js}"></script>
    <script src="js/zh.js" th:src="@{/js/zh.js}"></script>
    <script src="js/html5shiv.js" th:src="@{/js/html5shiv.js}"></script>
    <script src="js/respond.min.js" th:src="@{/js/respond.min.js}"></script>
</head>
<body>
<!--顶部-->
<div th:replace="~{common/common::top2}"></div>
<!-- /.container-fluid -->

<!--侧边-->
<div class="container-fluid">
    <div class="row ">
        <div th:replace="~{common/common::side}"></div>
        <!-- 显示表格数据 -->
        <div class=" col-md-8 publish wow fadeInUp" id="right"><!-- 将数据appendTo tbody 定义id -->
            <table class="table table-striped">
                <thead>
                <tr>
                    <th>ID</th>
                    <th>商品名</th>
                    <th>商品描述</th>
                    <th>商品价格</th>
                    <th>商品类别</th>
                    <th>商家ID</th>
                    <th>是否售出</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                    <tr th:each="good:${goods.list}">
                        <td th:text="${good.getId()}"></td>
                        <td th:text="${good.getName()}"></td>
                        <td th:text="${good.getGdesc()}"></td>
                        <td th:text="${good.getPrice()}"></td>
                        <td th:text="${good.getCategory().cname}"></td>
                        <td th:text="${good.getUid()}"></td>
                        <td th:text="${good.getIs_selling()==0?'售出':'未售出'}"></td>
                        <td>
                            <a class="btn btn-danger btn-sm" th:href="@{/deleteGoods/}+${good.getId()}">下架</a>
                        </td>
                    </tr>
                </tbody>
            </table>
            <nav aria-label="Page navigation example">
                <ul class="pagination">
                    <li class="page-item">
                        <a class="page-link" href="#" th:href="@{/getGoods(pageNum=${goods.getPrePage()})}" aria-label="Previous">
                            <span aria-hidden="true">&laquo;</span>
                        </a>
                    </li>
                    <li class="page-item" th:class="${goods.getPageNum()%5==1?'page-item active':'page-item'}"><a class="page-link" href="#" th:href="@{/getGoods(pageNum=1)}" th:text="${goods.getPageNum()>2?goods.getPageNum()-2:1}" >1</a></li>
                    <li class="page-item" th:class="${goods.getPageNum()%5==2?'page-item active':'page-item'}"><a class="page-link" href="#" th:href="@{/getGoods(pageNum=2)}" th:text="${goods.getPageNum()>2?goods.getPageNum()-1:2}">2</a></li>
                    <li class="page-item" th:class="${goods.getPageNum()%5==3?'page-item active':'page-item'}"><a class="page-link" href="#" th:href="@{/getGoods(pageNum=3)}" th:text="${goods.getPageNum()>2?goods.getPageNum():3}">3</a></li>
                    <li class="page-item" th:class="${goods.getPageNum()%5==4?'page-item active':'page-item'}"><a class="page-link" href="#" th:href="@{/getGoods(pageNum=4)}" th:text="${goods.getPageNum()>2?goods.getPageNum()+1:4}">4</a></li>
                    <li class="page-item" th:class="${goods.getPageNum()%5==0?'page-item active':'page-item'}"><a class="page-link" href="#" th:href="@{/getGoods(pageNum=5)}" th:text="${goods.getPageNum()>2?goods.getPageNum()+2:5}">5</a></li>
                    <li class="page-item">
                        <a class="page-link" href="#" th:href="@{/getGoods(pageNum=${goods.getNextPage()})}"aria-label="Next">
                            <span aria-hidden="true">&raquo;</span>
                        </a>
                    </li>
                </ul>
            </nav>
        </div>
    </div>
</div>




<script th:src="@{/js/wow.min.js}" src="js/wow.min.js"></script>
<script>
    $(function(){

        new WOW().init();
    })
</script>
</body>
</html>
